#!/bin/bash
#https://wiki.debian.org/EmDebian/CrossDebootstrap#QEMU.2Fdebootstrap_approach
dir="debian_armel_jessy"
ver="jessy"

apt-get install binfmt-support qemu qemu-user-static debootstrap

mkdir $dir

debootstrap --foreign --arch armel $ver $dir http://ftp.debian.org/debian/

cp /usr/bin/qemu-arm-static $dir/usr/bin

DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
 LC_ALL=C LANGUAGE=C LANG=C chroot $dir /debootstrap/debootstrap --second-stage

DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
 LC_ALL=C LANGUAGE=C LANG=C chroot $dir dpkg --configure -a

echo "Welcome to your ARM chroot!"

chroot $dir bash